<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<title>
		${shop.shopNameCn}
	</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=0.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
	<meta name=”apple-mobile-web-app-capable” content=”yes” />
	<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript">
		wx.config({
			debug : false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
			appId : '${appId}', // 必填，公众号的唯一标识
			timestamp : '${timestamp}', // 必填，生成签名的时间戳(是否需要引号？)
			nonceStr : '${nonceStr}', // 必填，生成签名的随机串
			signature : '${signature}',// 必填，签名，见附录1
			jsApiList : [ 'checkJsApi', 'openLocation', 'getLocation' ]// 必填，需要使用的JS接口列表，所有JS接口列表见附录2
		});
	</script>
	
	<script type="text/javascript">
	wx.ready(function() {
		
		wx.checkJsApi({
		    jsApiList: [
		        'getLocation'
		    ],
		    success: function (res) {
		        // alert(JSON.stringify(res));
		        // alert(JSON.stringify(res.checkResult.getLocation));
		        if (res.checkResult.getLocation == false) {
		            alert('你的微信版本太低，不支持微信JS接口，请升级到最新的微信版本！');
		            return;
		        }
		    }
		});
		
		wx.getLocation({
		    success: function (res) {
		        var latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
		        var longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。
		        var speed = res.speed; // 速度，以米/每秒计
		        var accuracy = res.accuracy; // 位置精度
		        
		        var str = escape(latitude+","+longitude);
		        
				// 设置Cookie
				// 获取当前时间
				var date = new Date();
				// 设置过期时间（单位：日）
				var expiresDays = 30;
				// 将date设置为expiresDays天以后的时间
				date.setTime(date.getTime() + expiresDays * 24 * 3600 * 1000);
				// 在浏览器中设置cookie
				document.cookie = "current_location=" +str+ "; expires="
				        + date.toGMTString() + ";path=/";
		        
		    },
		    cancel: function (res) {
		        
		    }
		});
		
		// config信息验证后会执行ready方法，
		//所有接口调用都必须在config接口获得结果之后，
		//config是一个客户端的异步操作，
		//所以如果需要在页面加载时就调用相关接口，
		//则须把相关接口放在ready函数中调用来确保正确执行。
		//对于用户触发时才调用的接口，则可以直接调用，
		//不需要放在ready函数中。
	});

	wx.error(function(res) {
		//alert('error');
		// config信息验证失败会执行error函数，如签名过期导致验证失败，
		//具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。

	});
</script>
	
	<script type="text/javascript">
		;(function (doc, win) {
		    var docEl = doc.documentElement,
		      resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		      recalc = function () {
		        var clientWidth = docEl.clientWidth;
		        var clientHeight = docEl.clientHeight;
		        if (!clientWidth) return;
		        if (clientWidth < clientHeight) {
		            docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
		        }else{
		          docEl.style.fontSize = 50 * (clientWidth / 1136) + 'px';
		        }
		      };
		      recalc();
		    if (!doc.addEventListener) return;
		    win.addEventListener(resizeEvt, recalc, false);
		    doc.addEventListener('DOMContentLoaded', recalc, false);
		})(document, window);
	</script>
	
	<link rel="stylesheet" href="${static_server}/static/css/default.css">
	<link rel="stylesheet" href="${server}/static/css/iconfont/iconfont.css">
	<link rel="stylesheet" href="${static_server}/static/css/shopIndex.css">
	<%-- <script type="text/javascript" src="${static_server}/static/js/resize.js"></script> --%>
<style>
@media only screen and (min-width: 375px) and (max-height: 480px){
    .srcollBox{height: 3.4rem}
}
@media only screen and (min-width: 375px) and (max-height: 568px){
    .srcollBox{height: 5.3rem}
}
@media only screen and (min-width: 320px){
   .srcollBox{height: 4.6rem}
}
	
</style>
</head>
<body>
<div class="wrap">
	<!-- <header class="headerToFixed">
		
	</header> -->
	<div class="contentWrap">
		<div class="shopHead">
			<div class="imgBox">
				<img src="${static_server}${shop.shopIcon}">
			</div>
			<div class="detailBox">
				${shop.shopDesc}
			</div>
		</div>
		<div class="shopBody mts2">
			<div id="J_tabComponent" class="tabComponent">
				<div class="tabListBox">
					<ul class="tabList">
						<li class="selected" >
							<%-- 商家活动 --%>
							<a href="#busActivity"><spring:message code="YYK-10001"/></a>
						</li>
						<li class="end">
							<%-- 合作伙伴优惠 --%>
							<a href="#partnerCoupons"><spring:message code="YYK-10002"/></a>
						</li>
						<li>
							<%-- 空箱服务 --%>
							<a href="#emptyBoxService" ><spring:message code="YYK-10000"/></a>
						</li>
					</ul>
				</div>
				<div id="busActivity" class="busActivity">
					<div class="srcollBox">
						<div id="wrapper" class="J_wrapper">
							<div  id="scroller">
								<ul  id="J_productList" class="productList">
									<c:forEach items="${merchandises}" var="merchandise">
										<li>
											<div class="pImgS">
												<a href="${server}/merchandise/${merchandise.merchandiseNumber}.html">
													<img src="${static_server}${merchandise.merchandiseIcon}">
												</a>
											</div>
											<div class="pDetail">
												<a href="${server}/merchandise/${merchandise.merchandiseNumber}.html">
													<p class="pTitle">
													
											<c:choose>
								 				<c:when test="${fn:length(merchandise.merchandiseNameCn) <= 17}">
								 					${merchandise.merchandiseNameCn}
								 				</c:when>
								 				<c:otherwise>
								 					${fn:substring(merchandise.merchandiseNameCn,0,15)}...
								 				</c:otherwise>
								 			</c:choose>
													
													</p>
												
												<p class="pML">${merchandise.merchandiseSpec}</p></a>
												<div class="suggestP fr">
													<%-- 国内价--%>
													<label class="insidePrice"><spring:message code="YYK-10004"/>&nbsp;<span><fmt:formatNumber value="${merchandise.merchandiseDomesticPrice}" pattern="￥#" />
													</span></label>
													<%-- 店内价--%>
													<label class="J_singleTotalA"><spring:message code="YYK-10005"/><span class="countSingleA redFont"><fmt:formatNumber value="${merchandise.merchandisePrice}" pattern="€0.00#" />
														</span>
													</label>
												</div>
											</div>
										</li>
									</c:forEach>
								</ul>
							</div>
						</div>
					</div>
				</div>			
				<div id="partnerCoupons" class="partnerCoupons">
					<div class="srcollBox">
						<div id="wrapper2" class="J_wrapper">
							<div  id="scroller">
								<ul  id="J_partnerList" class="partnerList">
								
									<a href="http://www.cmbchina.com/"  target="_blank">
									<li>
										<div class="iconBox">
											<img src="${static_server}/static/images/partnerImg/merchants.png" height="93" width="205" alt="">
										</div>
										<div class="activityTips text-hidden">
											刷招行卡，每周五单抽一单返5%
										</div>
									</li>
									</a>
									
								</ul>
							</div>
						</div>
					</div>
				</div>
				<div id="emptyBoxService" class="emptyBoxService">
					<div class="srcollBox" style="background:#fff">
						<div id="wrapper0" class="J_wrapper">
							<div  id="scroller">
								<ul>
									<%-- 直接退税并直邮到您的国内地址，没有最低消费限制，省去机场退税繁琐，不用担心行李超重，为您的行程减负。 --%>
									<li style="font-size:0.24rem;text-align: center;margin-top: -27px;">
										<%-- <spring:message code="YYK-10003"/> --%>
										<img style="width:90%;height:90%;" src="${static_server}/static/images/shopIndex/empty-box-service.png">
									</li>
								</ul>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<footer class="footerToFixed">
		<a href="${server}/cart/index/${shop.shopId}">
			<div class="operateBtnG">
			<%-- 店内自助--%>
			<spring:message code="YYK-10006"/>
			</div>
		</a>
	</footer>
</div>

<input type="hidden" id="server" value="${server}"/>
<input type="hidden" id="staticServer" value="${static_server}"/>
<input type="hidden" id="shopId" value="${shop.shopId}"/>
<input type="hidden" id="currentPage" value="1"/>
</body>
<script type="text/javascript" src="${static_server}/static/js/iscroll.js"></script>
<script type="text/javascript" src="${static_server}/static/js/zepto.min.js"></script>
<script type="text/javascript" src="${static_server}/static/js/shop/shop.js"></script>
</html>	